package com.awesome.web.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.awesome.core.entity.User;
import com.awesome.core.service.IUserService;

/**
 * <p>
 * user table 前端控制器
 * </p>
 *
 * @author Hongkai.Wang
 * @since 2020-12-10
 */
@RestController
@RequestMapping("/users")
public class UserController {

    @Resource
    private IUserService userService;

    @GetMapping("/{id}")
    public User users(@PathVariable Long id) {
        return userService.getById(id);
    }

    @GetMapping(value = {"/", ""})
    public List<User> users() {
        return userService.list();
    }

}
